#!/bin/make
#

TARGETS = local.o65 main.o65 lib.o65

#
# commands
#

RM = del /F /Q
AS = ca65
LD = ld65

#
# Flags
#

ASFLAGS = -t vic20 -g  -I .
LDFLAGS = 

#
# targets
#

.PHONY : all clean

all:	$(TARGETS)

clean:
	$(RM) $(TARGETS)

#
# Dependencies
#

$(TARGETS) : $(patsubst %.o65,%.cfg,$(TARGETS))

#
# Pattern rules
#

.SUFFIXES:
.SUFFIXES: .asm .o

%.o : %.asm
	$(AS) $(ASFLAGS) -o $@ $<

%.o65 : %.o
	$(LD) $(LDFLAGS) -C $(patsubst %.o65,%.cfg,$@) -m $(patsubst %.o65,%.map,$@) -Ln $(patsubst %.o65,%.lbl,$@) -o $@ $(filter %.o,$^)
